package IOStreamTest.BufferedStream;

import java.io.*;

/*
BufferedWriter:带有缓冲区的字符输出流
 */
public class BufferedWriterTest1 {
    public static void main(String[] args) {
        BufferedWriter bw = null;
        try {
            //bw = new BufferedWriter(new FileWriter("D:\\myFile1.txt"));
            //运用字符转换流
            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("D:\\myFile1.txt",true)));
            bw.write("猫在走猫步");
            bw.write("\n");
            bw.write("鸟儿在飞翔");
            bw.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }finally{
            if (bw != null) {
                try {
                    bw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
